import qs from 'qs'
import axios from './request.js'
export default {
    login(param) {
        return axios.post('/login', qs.stringify(param))
    },
    logout() {
        return axios.post('/logout')
    },
    getInfo(param) {
        return axios.get('/getInfo', param)
    },
    userList(param) { // 账号/客户列表
        return axios.post('/system/user/list', param)
    },
    getOpenerOption() { // 开通人员列表
        return axios.get('/system/user/option')
    },
    sysUserBelong() { // 客户从属字典查询
        return axios.get('/system/dict/sys_user_belong')
    },
    systemProfile() {
        return axios.get('/system/profile').then(({ data }) => data)
    },
    // 修改个人基本信息
    resetBaseinfo(param) {
        return axios.post('/system/profile/edit/baseinfo', param)
    },
    // 修改密码
    resetPassword(param) {
        return axios.post('/system/profile/edit/pass', param)
    },
    // 用户详情(基本信息)
    systemUserDetail(userId) {
        return axios.get(`/system/user/detail/${userId}`)
    },
    //
    systemDict(dictType) {
        return axios.get(`/system/dict/${dictType}`)
    },
    //添加客户
    addSystemUser(param) {
        return axios.post(`/system/user/add`, param)
    },
    editSystemUser(param) {
        return axios.post('/system/user/edit', param)
    },
    deleteCusUser(param) {
        let url = '/system/user/del/' + param
        return axios.get(url)
    },
    frozenUser(param) {
        let url = '/system/user/frozen/' + param.userId + '/' + param.type;
        return axios.get(url)
    },
    userDetail(param) {
        let url = '/system/user/detail/' + param;
        return axios.get(url)
    },
    addScheme(param) {
        return axios.post('/opinion/scheme/add', param)
    },
    delScheme(param) {
        let url = '/opinion/scheme/del/' + param
        return axios.get(url)
    },
    sysArea() { // 来源区域下拉框
        return axios.get('/system/dict/sys_area')
    },
    sysDataSource() { // 来源类型列表
        return axios.get('/system/dict/sys_data_source')
    },
    saveCondition(param) {
        return axios.post('/opinion/scheme/condition', param)
    },
    getCondition(param) {
        let url = '/opinion/scheme/condition/' + param
        return axios.get(url)
    },
    // 删除文件夹
    delFolder(id) {
        return axios.post(`/opinion/report/folder/del/${id}`)
    },
    // 编辑文件夹
    editFolder(param) {
        return axios.post('/opinion/report/folder/edit', param)
    },
    warnSetUpdate(param) {
        return axios.post('/opinion/warnSetting/update', param)
    },
    warnSetting(param) {
        let url = '/opinion/warnSetting/detail/' + param
        return axios.get(url)
    },
    bulletinList(param) {
        return axios.post('/opinion/bulletin/list', param)
    },
    templateList() {
        return axios.get('/opinion/bulletin/template/list')
    },
    templateAdd(param) {
        return axios.post('/opinion/bulletin/template/add', param)
    },
    templateDel(param) {
        let url = '/opinion/bulletin/template/del/' + param
        return axios.get(url)
    },
    templateDefault(param) {
        let url = '/opinion/bulletin/template/default/' + param
        return axios.get(url)
    },
    templateDetail(param) {
        let url = '/opinion/bulletin/template/detail/' + param
        return axios.get(url)
    },

    //智能搜索
    //拉去预警对象
    fetchMember() {
        let url = '/opinion/warn/users'
        return axios.get(url)
    },
    //拉取智能搜索接口
    fetchSearchList(param) {
        return axios.post('/opinion/search', param)
    },
    //发送预警
    sentWarn(param) {
        return axios.post('/opinion/article/warn', param)
    },
    //修改情绪状态
    modifyEmotion(param) {
        return axios.post('/opinion/article/modify/emotion', param)
    },
    //批量加入素材
    multiAddDir(param) {
        return axios.post('/opinion/article/addmaterial', param)
    },
    //收藏文件夹列表
    fetchDirList() {
        return axios.get('/opinion/collect/folder/list')
    },
    //添加收藏
    addCollect(param) {
        return axios.post('/opinion/collect/add', param)
    },
    //添加收藏夹
    addFolder(param) {
        return axios.post('/opinion/collect/folder/add', param)
    },
    //获取各个源的统计结果
    fetchCatInsList(param) {
        return axios.post('/opinion/search/stat', param)
    },
    //取消收藏
    cancelCollect(param) {
        let url = '/opinion/collect/del/' + param
        return axios.get(url)
    },
    /**
     * 首页接口
     */
    //首页的方案
    fetchSchemeList() {
        return axios.get('/opinion/scheme/list')
    },
    //首页的舆论趋势折线图 1折线图 2柱状图 3词云 4 地图
    fetchLineData(param, type) {
        let url = type == 1
            ? '/opinion/scheme/analyse/line'
            : type == 2
                ? '/opinion/scheme/analyse/media/emotion'
                : type == 3
                    ? '/opinion/scheme/analyse/wordcloud'
                    : type == 4
                        ? '/opinion/scheme/analyse/region'
                        : '';
        return axios.post(url, param)
    },
     /**
     * 我的收藏接口
     */
    fetchMyCollectList(param) {
        return axios.post('/opinion/collect/list', param)
    },
    cancelCollectList(param) {
        return axios.post('/opinion/collect/del', param)
    },
    clearCollectList(param) {
        let url = '/opinion/collect/clean/' + param
        return axios.get(url)
    }
}
